package com.ruoyi.web.controller.retirement;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.retirement.domain.RetirementArticle;
import com.ruoyi.retirement.service.IRetirementArticleReviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 文章审核Controller
 * 
 * @author 曹旭
 * @date 2025-09-02
 */
@RestController
@RequestMapping("/retirement/retirementArticleReview")
public class RetirementArticleReviewController extends BaseController
{
    @Autowired
    private IRetirementArticleReviewService retirementArticleReviewService;

    /**
     * 查询文章审核列表
     */
    @PreAuthorize("@ss.hasPermi('retirement:retirementArticleReview:list')")
    @GetMapping("/list")
    public TableDataInfo list(RetirementArticle retirementArticleReview)
    {
        startPage();
        List<RetirementArticle> list = retirementArticleReviewService.selectRetirementArticleReviewList(retirementArticleReview);
        return getDataTable(list);
    }



    /**
     * 审核接口
     */
    @PostMapping("/articleReview")
    public AjaxResult articleReview(@RequestBody RetirementArticle retirementArticleReview)
    {
        return toAjax(retirementArticleReviewService.articleReview(retirementArticleReview));
    }


    /**
     * 置顶与取消置顶文章
     */
    @PostMapping("/stickToTop")
    public AjaxResult stickToTop(@RequestBody RetirementArticle retirementArticleReview)
    {
        return toAjax(retirementArticleReviewService.stickToTop(retirementArticleReview));
    }

    /**
     * 撤销发布
     */
    @PostMapping("/unpublish")
    public AjaxResult unpublish(@RequestBody RetirementArticle retirementArticleReview)
    {
        return toAjax(retirementArticleReviewService.unpublish(retirementArticleReview));
    }


}
